/**
 * @file      main.c
 * @brief
 * @version   1.0
 * @date      2023.12.14
 *
 * @copyright Copyright (c) 2018 UCchip Technology Co.,Ltd. All rights reserved.
 *
 * Change Logs:
 * Date          Author       Notes
 * 2023.12.14    ucchip       the first version
 *
 */
#include "config_api.h"
#include "gateway_app.h"
#include "watchdog_app.h"
#include <rtthread.h>
#ifdef RT_TASK_RESOURCE_TOOL
#include "resource_manager.h"
#endif
#define DBG_ENABLE
#define DBG_SECTION_NAME "main"
#include "uc_log.h"

// 注意：rt_scheduler_sethook冲突，打开SYSTEM_TEST，需要关闭RT_TASK_RESOURCE_TOOL功能
// #define SYSTEM_TEST

// 20S间隔轮训一次信息
#define RESOUCE_TIME 20000

static unsigned int g_time_count = 0;
extern void wiota_send_timeout_data_check_msg(void);

#ifdef SYSTEM_TEST
void idle_heap_hook(struct rt_thread *from, struct rt_thread *to)
{
}
#endif

int main(void)
{
#ifdef SYSTEM_TEST
    rt_scheduler_sethook(idle_heap_hook);
#endif

    gateway_enter();

#ifdef RT_TASK_RESOURCE_TOOL
    resource_manager_init();
    while (1)
    {
        rt_thread_delay(RESOUCE_TIME);
        // resource_manager(RESOURCE_DETAIL_MODE);
        resource_manager(RESOURCE_SIMPLE_MODE);
        wiota_send_timeout_data_check_msg();
    }
#endif
}
